package br.com.duduso.conferencia_claro_desktop.screens;

import br.com.duduso.conferencia_claro_desktop.components.Mensagens;
import br.com.duduso.conferencia_claro_desktop.components.TabButton;
import java.awt.Component;

/**
 *
 * @author duduso
 */
public class GUIPrincipal extends javax.swing.JFrame {

    public GUIPrincipal() {
            initComponents();
            setLocationRelativeTo(null);
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu4 = new javax.swing.JMenu();
        jMenu5 = new javax.swing.JMenu();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        menuBar = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        menuItemConferirContas = new javax.swing.JMenuItem();
        menuSerasa = new javax.swing.JMenu();
        menuItemGerarClientesAtivos = new javax.swing.JMenuItem();

        jMenu4.setText("File");
        jMenuBar1.add(jMenu4);

        jMenu5.setText("Edit");
        jMenuBar1.add(jMenu5);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);

        jTabbedPane1.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT);
        jTabbedPane1.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N

        jMenu1.setText("Conferências Claro");
        jMenu1.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N

        menuItemConferirContas.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
        menuItemConferirContas.setText("Conferir Contas Claro");
        menuItemConferirContas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemConferirContasActionPerformed1(evt);
            }
        });
        jMenu1.add(menuItemConferirContas);

        menuBar.add(jMenu1);

        menuSerasa.setText("Serasa");
        menuSerasa.setBorderPainted(true);
        menuSerasa.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N

        menuItemGerarClientesAtivos.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
        menuItemGerarClientesAtivos.setText("Gerar DBF Clientes Ativos");
        menuItemGerarClientesAtivos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemGerarClientesAtivosActionPerformed(evt);
            }
        });
        menuSerasa.add(menuItemGerarClientesAtivos);

        menuBar.add(menuSerasa);

        setJMenuBar(menuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 952, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 564, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void menuItemGerarClientesAtivosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemGerarClientesAtivos
            adicionarTab(Mensagens.getInstance().getMessage("tituloAbaDBFSerasa"),
                    new TelaGeracaoDBF());
    }//GEN-LAST:event_menuItemGerarClientesAtivos

    private void menuItemConferirContasActionPerformed1(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemConferirContas
            adicionarTab(Mensagens.getInstance().getMessage("tituloAbaConferenciaClaro"),
                    new TelaConferenciaClaro(this));
    }//GEN-LAST:event_menuItemConferirContas

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JMenuItem menuItemConferirContas;
    private javax.swing.JMenuItem menuItemGerarClientesAtivos;
    private javax.swing.JMenu menuSerasa;
    // End of variables declaration//GEN-END:variables

    public void adicionarTab(String titulo, Component pagina){
            jTabbedPane1.addTab(titulo, pagina);
            jTabbedPane1.setSelectedIndex((jTabbedPane1.getTabCount() - 1));
            jTabbedPane1.setTabComponentAt(jTabbedPane1.getSelectedIndex(), 
                    new TabButton(jTabbedPane1, Mensagens.getInstance().getFonteArialTamanho12Negrito()));
    }

}
